package cn.tedu.csmall.order.webapi.mapper;

import cn.tedu.csmall.commons.pojo.order.model.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface OrderMapper {
    // 新增订单的方法
    @Insert("insert into order_tbl(user_id,commodity_code,count,money) " +
            "values(#{userId},#{commodityCode},#{count},#{money})")
    void insertOrder(Order order);

    //删除订单的方法
    @Delete("delete from order_tbl where commodity_code=#{commodityCode} and user_id=#{userId}")
    void deleteByCommodityCodeAndUserId(@Param("commodityCode") String commodityCode,
                                        @Param("userId") String userId
    );
}
